Replication code for Teacher Expectations Matter

Review of Economics and Statistics
Production Date: April, 2019

Programs used: Stata 14, MATLAB

------------------------------------------------------------------------------------------
I. Data
------------------------------------------------------------------------------------------

All empirical results in the paper are based on the restricted-use Education Longitudinal Study 
of 2002 (ELS:2002), ranging from 2002 to 2014.

The restricted-use ELS:2002 data can be obtained from the National Center for Education Statistics (NCES).
To obtain the exact data we are using, please obtain permission from NCES (more details can be found in
https://nces.ed.gov/surveys/els2002/obtainingrest.asp). 

The reduced form analyses are conducted using Stata 14.0, and the measurement error model estimates and simulations
are obtained using Matlab 2014b.

------------------------------------------------------------------------------------------
II. Replicating Tables and Figures 
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
II.1 Analyses conducted using STATA 
------------------------------------------------------------------------------------------
Do-file
"EDEX0_Replication_Main.do"

a. save the restricted-use ELS:2002 data (all students) in .dta format to your preferred path folder. Create folders for tables and figures.
b. set the working directory (2nd line in EDEX0_Replication_Main).
c. read in the saved .dta file (4th line in EDEX0_Repliation_Main).
d. Run EDEX0_Replication_Main.do to replicate Tables 1,2, S1-S18, Figure 1, and Figure S1.
e. The do-file calls in the following do-files:

"EDEX1_Sample_Selection_and_Creation.do" : creates the analytic sample and define variables used.
"EDEX2_Student_Summary.do" : produces summary stats for the students in the analytic sample (Tables 1, S6, S7).
"EDEX3_Main_OLS.do" : runs the Main OLS analyses and analogous robustness checks (Tables 3, S8).
also creats "data_edex_analytic.dta"
"EDEX4_TableS2.do" : creates TableS2.
"EDEX5_Out_of_sample_mean.do" : compares in-sample and out-of-sample mean, replicates Table S3.
"EDEX6_Teachers_Summary.do" : produces summary stats for teachers (Tables S4).
"EDEX7_TeacherExpectationProduction.do" : produces Table 2.
"EDEX8_Disagreements.do" : produces Table S5.
"EDEX9_Logit_and_Probit.do" : produces Tables S9, S10.
"EDEX10_Pastor_Tim.do" : produces Tables S11, S12.
"EDEX11_IV_Tables.do" : produces Tables S13, S14. The file calls the following do-files:
-EdEx_Replication_generate_instruments.do : generates instruments used.
-EdEx_Replication_IV_do_1ststage.do : runs 1st stage, produces Table S13.
-EdEx_Replication_IV_do_ivregs.do : runs 2SLS.
-EdEx_Replication_IV_do_hausman_test : does Hausman tests.
"EDEX12_MNL.do" : produces Table S15.
"EDEX13_Other_Outcomes.do" : produces Table S16.
"EDEX14_Mechanisms.do" : produces Table S17.
"EDEX15_Figure1.do" produces Figure 1.
"EDEX16_Figure_S1.do" produces Figure 2.

------------------------------------------------------------------------------------------
II.2 Analyses conducted using MATLAB 
------------------------------------------------------------------------------------------
a. First, export following variables from "data_edex_analytic.dta" to a matlab data file:
 Y, T1, T2, y, t1, t2, bytxmstd, bytxrstd, cbyrace3, cbyrace6, cbyerace3, cbyerace6, cbymrace3, cbymrace6, f1rgp9.
rename them as Yo, T1o, T2o, yo, t1o, t2o, SM, SR, cbyrace3, cbyrace6, cbyerace3, cbyerace6, cbymrace3, cbymrace6, Xc.
b. The folder contains the following files:
"main_alt_bias1.m" : produces estimates in Table S19.
"main_alt_bias2.m" : produces estimates in Table S20.
"main_corr.m" produces estimates in Tables S21-S23.
"main_years.m" produces estimates in Table S24.
"Main.m" produces estimates in Table 4 and Table S18.
"simulation.m" produces Figures 2, S3.
"figure3_a_b.m" produces Figure 3, panel (a), (b).
"figure3_c_d_e_f.m" produces Figures 3(c)-(f), S3.
c. each "main_*.m" file has an associated "ERRORS_*.m" file that calculates standard errors
and a "LogLikelihood_*.m" file that calculates the log likehihood.

